home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / ixemul / sdk / man / cat2 / msgctl.0 < prev    next >
Encoding:
Text File  |  1998-06-15  |  5.4 KB  |  111 lines

  1.  
  2. MSGCTL(2)                  UNIX Programmer's Manual                  MSGCTL(2)
  3.  
  4. NNAAMMEE
  5.      mmssggccttll - message control operations
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
  9.      ##iinncclluuddee <<ssyyss//iippcc..hh>>
  10.      ##iinncclluuddee <<ssyyss//mmssgg..hh>>
  11.  
  12.      _i_n_t
  13.      mmssggccttll(_i_n_t _m_s_q_i_d, _i_n_t _c_m_d, _s_t_r_u_c_t _m_s_q_i_d___d_s _*_b_u_f)
  14.  
  15. DDEESSCCRRIIPPTTIIOONN
  16.      The mmssggccttll() system call performs some control operations on the message
  17.      queue specified by _m_s_q_i_d.
  18.  
  19.      Each message queue has a data structure associated with it, parts of
  20.      which may be altered by mmssggccttll() and parts of which determine the actions
  21.      of mmssggccttll().  The data structure is defined in <_s_y_s_/_m_s_g_._h> and contains
  22.      (amongst others) the following members:
  23.  
  24.      struct msqid_ds {
  25.          struct ipc_perm msg_perm;   /* msg queue permission bits */
  26.          u_long msg_cbytes; /* # of bytes in use on the queue */
  27.          u_long msg_qnum;   /* # of msgs in the queue */
  28.          u_long msg_qbytes; /* max # of bytes on the queue */
  29.          pid_t  msg_lspid;  /* pid of last msgsnd() */
  30.          pid_t  msg_lrpid;  /* pid of last msgrcv() */
  31.          time_t msg_stime;  /* time of last msgsnd() */
  32.          time_t msg_rtime;  /* time of last msgrcv() */
  33.          time_t msg_ctime;  /* time of last msgctl() */
  34.      };
  35.  
  36.      The ipc_perm  structure used inside the shmid_ds  structure is defined in
  37.      <_s_y_s_/_i_p_c_._h> and looks like this:
  38.  
  39.      struct ipc_perm {
  40.          ushort cuid; /* creator user id */
  41.          ushort cgid; /* creator group id */
  42.          ushort uid;  /* user id */
  43.          ushort gid;  /* group id */
  44.          ushort mode; /* permission (9 bits, see chmod(2)) */
  45.          ushort seq;  /* sequence # (to generate unique id) */
  46.          key_t key;   /* user specified msg/sem/shm key */
  47.      };
  48.  
  49.      The operation to be performed by mmssggccttll() is specified in _c_m_d and is one
  50.      of:
  51.  
  52.      IPC_STAT   Gather information about the message queue and place it in the
  53.                 structure pointed to by _b_u_f.
  54.  
  55.      IPC_SET    Set the value of the _m_s_g___p_e_r_m_._u_i_d, _m_s_g___p_e_r_m_._g_i_d, _m_s_g___p_e_r_m_._m_o_d_e
  56.                 and _m_s_g___q_b_y_t_e_s fields in the structure associated with _m_s_q_i_d.
  57.                 The values are taken from the corresponding fields in the
  58.                 structure pointed to by _b_u_f. This operation can only be exe-
  59.                 cuted by the super-user, or a process that has an effective
  60.                 user id equal to either _m_s_g___p_e_r_m_._c_u_i_d or _m_s_g___p_e_r_m_._u_i_d in the
  61.                 data structure associated with the message queue.  The value
  62.                 of _m_s_g___q_b_y_t_e_s can only be increased by the super-user. Values
  63.                 for _m_s_g___q_b_y_t_e_s that exceed the system limit (MSGMNB from
  64.                 <_s_y_s_/_m_s_g_._h>) are silently truncated to that limit.
  65.  
  66.  
  67.  
  68.      IPC_RMID   Remove the message queue specified by _m_s_q_i_d and destroy the
  69.                 data associated with it. Only the super-user or a process with
  70.                 an effective uid equal to the _m_s_g___p_e_r_m_._c_u_i_d or _m_s_g___p_e_r_m_._u_i_d
  71.                 values in the data structure associated with the queue can do
  72.                 this.
  73.  
  74.      The permission to read from or write to a message queue (see msgsnd(2)
  75.      and msgrcv(2))  is determined by the _m_s_g___p_e_r_m_._m_o_d_e field in the same way
  76.      as is done with files (see chmod(2)),  but the effective uid can match
  77.      either the _m_s_g___p_e_r_m_._c_u_i_d field or the _m_s_g___p_e_r_m_._u_i_d field, and the effec-
  78.      tive gid can match either _m_s_g___p_e_r_m_._c_g_i_d or _m_s_g___p_e_r_m_._g_i_d.
  79.  
  80. RREETTUURRNN VVAALLUUEESS
  81.      Upon successful completion, a value of 0 is returned. Otherwise, -1 is
  82.      returned and the global variable _e_r_r_n_o is set to indicate the error.
  83.  
  84. EERRRROORRSS
  85.      mmssggccttll() will fail if:
  86.  
  87.      [EPERM]       _c_m_d is equal to IPC_SET or IPC_RMID and the caller is not
  88.                    the super-user, nor does the effective uid match either the
  89.                    _m_s_g___p_e_r_m_._u_i_d or _m_s_g___p_e_r_m_._c_u_i_d fields of the data structure
  90.                    associated with the message queue.
  91.  
  92.                    An attempt is made to increase the value of _m_s_g___q_b_y_t_e_s
  93.                    through IPC_SET but the caller is not the super-user.
  94.  
  95.      [EACCESS]     The command is IPC_STAT and the caller has no read permis-
  96.                    sion for this message queue.
  97.  
  98.      [EINVAL]      _m_s_q_i_d is not a valid message queue identifier.
  99.  
  100.                    _c_m_d is not a valid command.
  101.  
  102.      [EFAULT]      _b_u_f specifies an invalid address.
  103.  
  104. SSEEEE AALLSSOO
  105.      msgsnd(2),  msgrcv(2),  msgget(2)
  106.  
  107. HHIISSTTOORRYY
  108.      Message queues appeared in the first release of AT&T Unix System V.
  109.  
  110.  NetBSD                         August 17, 1995                              2
  111.